package com.foyekoo.project001.command;

import com.foyekoo.project001.App;
import com.foyekoo.project001.utils.ByteUtil;
import com.foyekoo.project001.utils.MusicPlayFactory;

/**
 * 接受数据用的
 * 下位上发到上位
 */
public class ReceivedCommand  {

    /**
     *  获取播放的音乐
     * @param data
     * @return
     */
    public static String getPlayMusic(byte[] data){
        return MusicPlayFactory.getInstance().playMusic(data[3],App.getInstance());
    }

    /**
     * 当前游戏的时间
     * @param data
     * @return
     */
    public static String getCurrentPlayTime(byte[] data){
        return ( (data[3]) + "");
    }

    /**
     * 获取老化次数
     * @return
     */
    public static String getOldTestCount(byte[] data) {
        byte[] count = new byte[2];
        count[0] = data[4];
        count[1] = data[5];
        return Integer.parseInt(ByteUtil.byte2String(count),16) + "";
    }


}
